package c.e.a.b.e.c;

import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import javax.annotation.Nullable;

/* compiled from: com.google.android.gms:play-services-measurement-impl@@18.0.0 */
public abstract class l2<T> {
    public static final Object g = new Object();
    @Nullable
    public static volatile t2 h;
    public static u2 i = new u2(n2.a);
    public static final AtomicInteger j = new AtomicInteger();
    public final q2 a;
    public final String b;
    public final T c;
    public volatile int d = -1;
    public volatile T e;
    public final boolean f;

    static {
        AtomicReference atomicReference = new AtomicReference();
    }

    public l2(q2 q2Var, String str, Object obj, boolean z, m2 m2Var) {
        if (q2Var.a != null) {
            this.a = q2Var;
            this.b = str;
            this.c = obj;
            this.f = z;
            return;
        }
        throw new IllegalArgumentException("Must pass a valid SharedPreferences file name or ContentProvider URI");
    }

    public abstract T a(Object obj);

    public final String b(String str) {
        if (str != null && str.isEmpty()) {
            return this.b;
        }
        str = String.valueOf(str);
        String valueOf = String.valueOf(this.b);
        return valueOf.length() != 0 ? str.concat(valueOf) : new String(str);
    }

    public final String c() {
        Objects.requireNonNull(this.a);
        return b("");
    }

    /* JADX WARNING: Removed duplicated region for block: B:42:0x00c2  */
    /* JADX WARNING: Removed duplicated region for block: B:41:0x00c1  */
    /* JADX WARNING: Removed duplicated region for block: B:54:0x00f6  */
    public final T d() {
        /*
        r7 = this;
        r0 = r7.f;
        r1 = 1;
        if (r0 != 0) goto L_0x0016;
    L_0x0005:
        r0 = i;
        r2 = r7.b;
        java.util.Objects.requireNonNull(r0);
        r0 = "flagName must not be null";
        java.util.Objects.requireNonNull(r2, r0);
        r0 = "Attempt to access PhenotypeFlag not via codegen. All new PhenotypeFlags must be accessed through codegen APIs. If you believe you are seeing this error by mistake, you can add your flag to the exemption list located at //java/com/google/android/libraries/phenotype/client/lockdown/flags.textproto. Send the addition CL to ph-reviews@. See go/phenotype-android-codegen for information about generated code. See go/ph-lockdown for more information about this error.";
        c.e.a.b.b.j.d.M(r1, r0);
    L_0x0016:
        r0 = j;
        r0 = r0.get();
        r2 = r7.d;
        if (r2 >= r0) goto L_0x0149;
    L_0x0020:
        monitor-enter(r7);
        r2 = r7.d;	 Catch:{ all -> 0x0146 }
        if (r2 >= r0) goto L_0x0144;
    L_0x0025:
        r2 = h;	 Catch:{ all -> 0x0146 }
        r3 = 0;
        if (r2 == 0) goto L_0x002c;
    L_0x002a:
        r4 = 1;
        goto L_0x002d;
    L_0x002c:
        r4 = 0;
    L_0x002d:
        r5 = "Must call PhenotypeFlag.init() first";
        c.e.a.b.b.j.d.M(r4, r5);	 Catch:{ all -> 0x0146 }
        r4 = r2.a();	 Catch:{ all -> 0x0146 }
        r4 = c.e.a.b.e.c.c2.b(r4);	 Catch:{ all -> 0x0146 }
        r5 = "gms:phenotype:phenotype_flag:debug_bypass_phenotype";
        r4 = r4.a(r5);	 Catch:{ all -> 0x0146 }
        r4 = (java.lang.String) r4;	 Catch:{ all -> 0x0146 }
        if (r4 == 0) goto L_0x0051;
    L_0x0044:
        r5 = c.e.a.b.e.c.u1.c;	 Catch:{ all -> 0x0146 }
        r4 = r5.matcher(r4);	 Catch:{ all -> 0x0146 }
        r4 = r4.matches();	 Catch:{ all -> 0x0146 }
        if (r4 == 0) goto L_0x0051;
    L_0x0050:
        goto L_0x0052;
    L_0x0051:
        r1 = 0;
    L_0x0052:
        r3 = 0;
        if (r1 != 0) goto L_0x0095;
    L_0x0055:
        r1 = r7.a;	 Catch:{ all -> 0x0146 }
        r1 = r1.a;	 Catch:{ all -> 0x0146 }
        if (r1 == 0) goto L_0x007c;
    L_0x005b:
        r1 = r2.a();	 Catch:{ all -> 0x0146 }
        r4 = r7.a;	 Catch:{ all -> 0x0146 }
        r4 = r4.a;	 Catch:{ all -> 0x0146 }
        r1 = c.e.a.b.e.c.j2.a(r1, r4);	 Catch:{ all -> 0x0146 }
        if (r1 == 0) goto L_0x007a;
    L_0x0069:
        r1 = r2.a();	 Catch:{ all -> 0x0146 }
        r1 = r1.getContentResolver();	 Catch:{ all -> 0x0146 }
        r4 = r7.a;	 Catch:{ all -> 0x0146 }
        r4 = r4.a;	 Catch:{ all -> 0x0146 }
        r1 = c.e.a.b.e.c.y1.b(r1, r4);	 Catch:{ all -> 0x0146 }
        goto L_0x0084;
    L_0x007a:
        r1 = r3;
        goto L_0x0084;
    L_0x007c:
        r1 = r2.a();	 Catch:{ all -> 0x0146 }
        r1 = c.e.a.b.e.c.s2.b(r1);	 Catch:{ all -> 0x0146 }
    L_0x0084:
        if (r1 == 0) goto L_0x00be;
    L_0x0086:
        r4 = r7.c();	 Catch:{ all -> 0x0146 }
        r1 = r1.a(r4);	 Catch:{ all -> 0x0146 }
        if (r1 == 0) goto L_0x00be;
    L_0x0090:
        r1 = r7.a(r1);	 Catch:{ all -> 0x0146 }
        goto L_0x00bf;
    L_0x0095:
        r1 = "PhenotypeFlag";
        r4 = 3;
        r1 = android.util.Log.isLoggable(r1, r4);	 Catch:{ all -> 0x0146 }
        if (r1 == 0) goto L_0x00be;
    L_0x009e:
        r1 = "PhenotypeFlag";
        r4 = "Bypass reading Phenotype values for flag: ";
        r5 = r7.c();	 Catch:{ all -> 0x0146 }
        r5 = java.lang.String.valueOf(r5);	 Catch:{ all -> 0x0146 }
        r6 = r5.length();	 Catch:{ all -> 0x0146 }
        if (r6 == 0) goto L_0x00b5;
    L_0x00b0:
        r4 = r4.concat(r5);	 Catch:{ all -> 0x0146 }
        goto L_0x00bb;
    L_0x00b5:
        r5 = new java.lang.String;	 Catch:{ all -> 0x0146 }
        r5.<init>(r4);	 Catch:{ all -> 0x0146 }
        r4 = r5;
    L_0x00bb:
        android.util.Log.d(r1, r4);	 Catch:{ all -> 0x0146 }
    L_0x00be:
        r1 = r3;
    L_0x00bf:
        if (r1 == 0) goto L_0x00c2;
    L_0x00c1:
        goto L_0x00e6;
    L_0x00c2:
        r1 = r2.a();	 Catch:{ all -> 0x0146 }
        r1 = c.e.a.b.e.c.c2.b(r1);	 Catch:{ all -> 0x0146 }
        r4 = r7.a;	 Catch:{ all -> 0x0146 }
        java.util.Objects.requireNonNull(r4);	 Catch:{ all -> 0x0146 }
        r4 = "";
        r4 = r7.b(r4);	 Catch:{ all -> 0x0146 }
        r1 = r1.a(r4);	 Catch:{ all -> 0x0146 }
        if (r1 == 0) goto L_0x00e0;
    L_0x00db:
        r1 = r7.a(r1);	 Catch:{ all -> 0x0146 }
        goto L_0x00e1;
    L_0x00e0:
        r1 = r3;
    L_0x00e1:
        if (r1 == 0) goto L_0x00e4;
    L_0x00e3:
        goto L_0x00e6;
    L_0x00e4:
        r1 = r7.c;	 Catch:{ all -> 0x0146 }
    L_0x00e6:
        r2 = r2.b();	 Catch:{ all -> 0x0146 }
        r2 = r2.q();	 Catch:{ all -> 0x0146 }
        r2 = (c.e.a.b.e.c.x2) r2;	 Catch:{ all -> 0x0146 }
        r4 = r2.b();	 Catch:{ all -> 0x0146 }
        if (r4 == 0) goto L_0x0140;
    L_0x00f6:
        r1 = r2.c();	 Catch:{ all -> 0x0146 }
        r1 = (c.e.a.b.e.c.h2) r1;	 Catch:{ all -> 0x0146 }
        r2 = r7.a;	 Catch:{ all -> 0x0146 }
        r4 = r2.a;	 Catch:{ all -> 0x0146 }
        java.util.Objects.requireNonNull(r2);	 Catch:{ all -> 0x0146 }
        r2 = "";
        r5 = r7.b;	 Catch:{ all -> 0x0146 }
        java.util.Objects.requireNonNull(r1);	 Catch:{ all -> 0x0146 }
        if (r4 == 0) goto L_0x0137;
    L_0x010c:
        r4 = r4.toString();	 Catch:{ all -> 0x0146 }
        r1 = r1.a;	 Catch:{ all -> 0x0146 }
        r1 = r1.get(r4);	 Catch:{ all -> 0x0146 }
        r1 = (java.util.Map) r1;	 Catch:{ all -> 0x0146 }
        if (r1 != 0) goto L_0x011b;
    L_0x011a:
        goto L_0x0137;
    L_0x011b:
        r3 = java.lang.String.valueOf(r5);	 Catch:{ all -> 0x0146 }
        r4 = r3.length();	 Catch:{ all -> 0x0146 }
        if (r4 == 0) goto L_0x012a;
    L_0x0125:
        r2 = r2.concat(r3);	 Catch:{ all -> 0x0146 }
        goto L_0x0130;
    L_0x012a:
        r3 = new java.lang.String;	 Catch:{ all -> 0x0146 }
        r3.<init>(r2);	 Catch:{ all -> 0x0146 }
        r2 = r3;
    L_0x0130:
        r1 = r1.get(r2);	 Catch:{ all -> 0x0146 }
        r3 = r1;
        r3 = (java.lang.String) r3;	 Catch:{ all -> 0x0146 }
    L_0x0137:
        if (r3 != 0) goto L_0x013c;
    L_0x0139:
        r1 = r7.c;	 Catch:{ all -> 0x0146 }
        goto L_0x0140;
    L_0x013c:
        r1 = r7.a(r3);	 Catch:{ all -> 0x0146 }
    L_0x0140:
        r7.e = r1;	 Catch:{ all -> 0x0146 }
        r7.d = r0;	 Catch:{ all -> 0x0146 }
    L_0x0144:
        monitor-exit(r7);	 Catch:{ all -> 0x0146 }
        goto L_0x0149;
    L_0x0146:
        r0 = move-exception;
        monitor-exit(r7);	 Catch:{ all -> 0x0146 }
        throw r0;
    L_0x0149:
        r0 = r7.e;
        return r0;
        */
        throw new UnsupportedOperationException("Method not decompiled: c.e.a.b.e.c.l2.d():java.lang.Object");
    }
}
